//
//  LoginViewController.m
//  XingRun
//
//  Created by 赵颜彬 on 17/1/13.
//  Copyright © 2017年 赵颜彬. All rights reserved.
//

#import "LoginViewController.h"
#import "ZJSegmentStyle.h"
#import "ZJScrollPageViewDelegate.h"
#import "ZJScrollSegmentView.h"

@interface LoginViewController ()
{
    NSInteger _index;
    
}
@property(nonatomic, strong)UIView *v;
@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"登录";
    UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc] initWithTitle:@"注册" style:UIBarButtonItemStylePlain target:self action:@selector(popAction)];
    rightBtn.tintColor = [CGLTool hexStringToColor:@"33be61"];
    self.navigationItem.rightBarButtonItem = rightBtn;
    [self createScrollTitle];
    
    [self createView];

}

//注册
-(void)popAction{
    ZhuCeViewController *Vc = [[ZhuCeViewController alloc] init];
    [self.navigationController pushViewController:Vc animated:YES];
}

-(void)createScrollTitle{
    ZJSegmentStyle *style = [[ZJSegmentStyle alloc] init];
    //显示滚动条
    style.showLine = YES;
    // 颜色渐变
    //    style.gradualChangeTitleColor = YES;
    style.titleFont = [UIFont fontWithName:@"Helvetica" size:14];
;
    style.normalTitleColor = [UIColor blackColor];
    style.selectedTitleColor = [UIColor blackColor];
    style.titleMargin = 15;
    ZJScrollSegmentView *s = [[ZJScrollSegmentView  alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40 * HEIGHT) segmentStyle:style delegate:nil titles:@[@"      普通登录                  ", @"      验证码快捷登录      "] titleDidClick:^(ZJTitleView *titleView, NSInteger index) {
        if (index == 1) {
            [self createS];
        }
        if (index == 0) {
            [self.v removeFromSuperview];
        }
    }];
    
    [self.view addSubview:s];
}

-(void)createS{
    self.v = [[UIView alloc] initWithFrame:CGRectMake(0, 40, 375, 130)];
    _v.backgroundColor = [UIColor clearColor];
    [self.view addSubview:self.v];
    
    //登录框
    
    UIImageView *deng = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"普通登录登录"]];
    deng.frame = CGRectMake(20, 30, 375 - 40, 50);
    [_v addSubview:deng];
    
    UIImageView *mi = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"普通登录密码"]];
    mi.frame = CGRectMake(20, 80, 375 - 40, 50);
    [_v addSubview:mi];
    
    //验证码
    UIButton *yzm = [UIButton buttonWithType:UIButtonTypeCustom];
    [deng addSubview:yzm];
    
    
    // 创建imageview
    UIImage *image = [UIImage imageNamed:@"注册获取验证码"];
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(223 * WIDTH, 4 * HEIGHT, 108 * WIDTH, 41 * HEIGHT)];
    [imageView setImage:image];
    [yzm addSubview:imageView];
    
    [deng addSubview:yzm];
    
    
    
    
}
-(void)createView{
    
    
    //背景图
    UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"普通登录背景"]];
    img.frame = CGRectMake(0, 40, self.view.frame.size.width, self.view.frame.size.height - 40 - 40);
    [self.view addSubview:img];
    
    //登录框
    
    UIImageView *deng = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"普通登录登录"]];
    deng.frame = CGRectMake(20, 30, 375 - 40, 50);
    [img addSubview:deng];
    
    UIImageView *mi = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"普通登录密码"]];
    mi.frame = CGRectMake(20, 80, 375 - 40, 50);
    [img addSubview:mi];
    
    
    
    //登录按钮
    UIImageView *an = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"普通登录登录按钮"]];
    an.frame = CGRectMake(20, 187, 375 - 40, 43);
    [img addSubview:an];
    
    //记住忘记密码
    UIImageView *ji1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"普通登录叉"]];
    ji1.frame = CGRectMake(20, 141, 87, 21);
    [img addSubview:ji1];
    
    UIImageView *wang = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"普通登录忘记密码"]];
    wang.frame = CGRectMake(375 - 20 - 73, 146, 73, 18);
    [img addSubview:wang];
    
    //三方登录
    UIImageView *wei = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"微信"]];
    wei.frame = CGRectMake(96, 445, 38, 38);
    [img addSubview:wei];
    
    UIImageView *QQ = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"QQ"]];
    QQ.frame = CGRectMake(96 + 34 + 38, 445, 38, 38);
    [img addSubview:QQ];
    
    UIImageView *bo = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"微博"]];
    bo.frame = CGRectMake(96 + 68 + 38 + 34, 445, 38, 38);
    [img addSubview:bo];
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
